<?php

namespace app\api\controller\intelligentlive;

use app\api\service\intelligentlive\DeviceService;
use think\Request;

class Device
{
    protected $Service;
    public function __construct()
    {
        $this->Service = DeviceService::getInstance();
    }

    public function addDevice(Request $request)
    {
        $params = $request->post();
        $result = $this->Service->addDevice($params);
        return writeJson(200,$result,"新增成功");
    }

    public function upDevice(Request $request)
    {
        $params = $request->post();
        $result = $this->Service->upDevice($params);
        return writeJson(200,$result,"更新成功");
    }

    public function delDevice(Request $request)
    {
        $params = $request->post();
        $result = $this->Service->delDevice($params);
        return writeJson(200,$result,"删除成功");
    }

    public function deviceList(Request $request)
    {
        $params = $request->post();
        $result = $this->Service->deviceList($params);
        return writeJson(200,$result,"获取成功");
    }
}